<?php
namespace app\controller;

use app\BaseController;
use app\controller\MqProducer;

class Index
{
    public function index()
    {
        echo "tp6";die;
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }

    public function send()
    {
        $consumer = new MqProducer();//生产者
        for ($i=0; $i<10; $i++){
            sleep(1);
            $data = [
                'time'=>time(),
                'email1'=>rand(1,100),
            ];
            $consumer->pushMessage(json_encode($data));
        }
    }

    public function send2()
    {
        $consumer = new MqProducer();//生产者
        for ($i=0; $i<10; $i++){
            sleep(1);
            $data = [
                'time'=>time(),
                'email2'=>rand(1,100),
            ];
            $consumer->pushMessage2(json_encode($data));
        }
    }
}
